SUPPORT / SAMPLES & SAS NOTES
 

Support

Problem Note 67839: A DB2 VARCHAR data type is incorrectly created in a DB2 table when a column has the TRANSCODE=NO attribute

DetailsHotfixAboutRate It

A DB2 VARCHAR(nn) column is incorrectly created when all the following conditions are true:

  • The SAS maintenance release is earlier than SAS® 9.4M7 (TS1M7).
  • The DB2 server version is DB2 version 11 or later.
  • The SAS column attribute TRANSCODE=NO is assigned.
  • You create a DB2 table.

You might also see this issue when the DB2 client and server versions are different. For example, you are using a DB2 version 10 client and a DB2 version 11 server.

For DB2 version 10, you would expect TRANSCODE=NO to result in a DB2 column that is created as "VARCHAR(nn) FOR BIT DATA."

For DB2 version 11, you would expect TRANSCODE=NO to result in a DB2 column that is created as "VARBINARY(nn)."

The following syntax can demonstrate the issue:

LIBNAME db2lib DB=database USER=user-id PW=password ;
OPTIONS SASTRACE=',,,D' SASTRACELOC=SASLOG NOSTSUFFIX ;
DATA db2lib.db2table ;
   ATTRIB my-key LENGTH=$32 TRANSCODE=NO ;
   my-key='0000C21DE8BC5EEB6EC42B0000000A21'X ;
   FORMAT my-key $HEX32. ;
RUN ;

The SASTRACE output shows that the CREATE TABLE clause is generated as one of the following, and the last one is incorrect:

  • CREATE TABLE db2table (my-key VARCHAR(32) FOR BIT DATA)
  • CREATE TABLE db2table (my-key VARBINARY(32))
  • CREATE TABLE db2table (my-key VARCHAR(32))

The only workaround is to use the DBTYPE= data set option, as shown here:

LIBNAME db2lib DB=database USER=user-id PW=password ;
OPTIONS SASTRACE=',,,D' SASTRACELOC=SASLOG NOSTSUFFIX ;
DATA db2lib.db2table(DBTYPE=(my-key= 'VARCHAR(32) FOR BIT DATA'))
   ATTRIB my-key LENGTH=$32 TRANSCODE=NO ;
   my-key='0000C21DE8BC5EEB6EC42B0000000A21'X ;
   FORMAT my-key $HEX32. ;
RUN ;

Click the Hot Fix tab in this note to access the hot fix for this issue.



Operating System and Release Information

Product FamilyProductSystemProduct ReleaseSAS Release
ReportedFixed*ReportedFixed*
SAS SystemSAS/ACCESS Interface to DB2z/OS 64-bit9.439.449.4 TS1M69.4 TS1M7
z/OS9.439.449.4 TS1M69.4 TS1M7
Microsoft® Windows® for x649.439.449.4 TS1M69.4 TS1M7
Microsoft Windows 8 Enterprise 32-bit9.439.449.4 TS1M69.4 TS1M7
Microsoft Windows 8 Enterprise x649.439.449.4 TS1M69.4 TS1M7
Microsoft Windows 8 Pro 32-bit9.439.449.4 TS1M69.4 TS1M7
Microsoft Windows 8 Pro x649.439.449.4 TS1M69.4 TS1M7
Microsoft Windows 8.1 Enterprise 32-bit9.439.449.4 TS1M69.4 TS1M7
Microsoft Windows 8.1 Enterprise x649.439.449.4 TS1M69.4 TS1M7
Microsoft Windows 8.1 Pro 32-bit9.439.449.4 TS1M69.4 TS1M7
Microsoft Windows 8.1 Pro x649.439.449.4 TS1M69.4 TS1M7
Microsoft Windows 109.439.449.4 TS1M69.4 TS1M7
Microsoft Windows Server 20089.439.449.4 TS1M69.4 TS1M7
Microsoft Windows Server 2008 R29.439.449.4 TS1M69.4 TS1M7
Microsoft Windows Server 2008 for x649.439.449.4 TS1M69.4 TS1M7
Microsoft Windows Server 2012 Datacenter9.439.449.4 TS1M69.4 TS1M7
Microsoft Windows Server 2012 R2 Datacenter9.439.449.4 TS1M69.4 TS1M7
Microsoft Windows Server 2012 R2 Std9.439.449.4 TS1M69.4 TS1M7
Microsoft Windows Server 2012 Std9.439.449.4 TS1M69.4 TS1M7
Microsoft Windows Server 20169.439.449.4 TS1M69.4 TS1M7
Microsoft Windows Server 20199.439.449.4 TS1M69.4 TS1M7
Windows 7 Enterprise 32 bit9.439.449.4 TS1M69.4 TS1M7
Windows 7 Enterprise x649.439.449.4 TS1M69.4 TS1M7
Windows 7 Home Premium 32 bit9.439.449.4 TS1M69.4 TS1M7
Windows 7 Home Premium x649.439.449.4 TS1M69.4 TS1M7
Windows 7 Professional 32 bit9.439.449.4 TS1M69.4 TS1M7
Windows 7 Professional x649.439.449.4 TS1M69.4 TS1M7
Windows 7 Ultimate 32 bit9.439.449.4 TS1M69.4 TS1M7
Windows 7 Ultimate x649.439.449.4 TS1M69.4 TS1M7
64-bit Enabled AIX9.439.449.4 TS1M69.4 TS1M7
64-bit Enabled Solaris9.439.449.4 TS1M69.4 TS1M7
HP-UX IPF9.439.449.4 TS1M69.4 TS1M7
Linux for x649.439.449.4 TS1M69.4 TS1M7
Solaris for x649.439.449.4 TS1M69.4 TS1M7
* For software releases that are not yet generally available, the Fixed Release is the software release in which the problem is planned to be fixed.